﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CodeCamp.BL.Session>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Create
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<h2>
		Edit</h2>
	<% using (Html.BeginForm())
	{%>
	<fieldset>
		<legend>Fields</legend>
		<div class="editor-field">
			<%= Html.HiddenFor( model => model.SessionID) %>
		</div>
		<div class="editor-label">
			<%= Html.LabelFor(model => model.Name) %>
		</div>
		<div class="editor-field">
			<%= Html.TextBoxFor(model => model.Name) %>
			<%= Html.ValidationMessageFor(model => model.Name) %>
		</div>
		<div class="editor-label">
			<%= Html.LabelFor(model => model.Excerpt)%>
		</div>
		<div class="editor-field">
			<%= Html.TextAreaFor(model => model.Excerpt,6,64,null) %>
			<%= Html.ValidationMessageFor(model => model.Excerpt)%>
		</div>
		<div class="editor-label">
			<%= Html.LabelFor(model => model.Description) %>
		</div>
		<div class="editor-field">
			<%= Html.TextAreaFor(model => model.Description,8,64,null) %>
			<%= Html.ValidationMessageFor(model => model.Description) %>
		</div>
		<div class="editor-label">
			<%= Html.LabelFor(model => model.SegmentCount) %>
		</div>
		<div class="editor-field">
			<% Html.RenderPartial("SessionSegmentCount"); %>
		</div>
		<div class="editor-label">
			<%= Html.LabelFor(model => model.Tags) %>
		</div>
		<div class="editor-field">
			<%= Html.TextBox("tagList", string.Join(",",Model.Tags.Select(t=> t.Name ).ToArray())) %>
		</div>
		<p>
			<input type="submit" value="Update" />
		</p>
	</fieldset>
	<% } %>
	<% using (Html.BeginForm("AddFile", "Session", FormMethod.Post, new { enctype = "multipart/form-data" }))
	{
	%>
	<%= Html.HiddenFor(model => model.SessionID) %>
	<% foreach (var a in Model.Attachments)
	{%>
	<%= a.ShowDownloadLink("File","Download") %><br />
	<%
		}%>
	<div class="editor-label">
		Upload slide deck or presentation materials for this session<br />
	</div>
	<div class="editor-field">
		<input type="file" id="fileAttachment" name="fileAttachment" />
	</div>
	<input type="submit" value="Upload File" />
	<% } %>
	<div>
		<%=Html.ActionLink("Back to List", "Index") %>
	</div>
</asp:Content>
